import axios from "./ResponseIntercept";

export const registered = (name: string, passwrod: string) => {
  return axios({
    method: "post",
    url: "/zhanghao",
    data: {
      name: name,
      passwrod: passwrod,
      permissions: "普通管理员",
    },
    params: {
      zc: "注册",
    },
  });
};

export const login = (name: string, passwrod: string) => {
  return axios({
    method: "get",
    url: `/zhanghao?name=${name}&passwrod=${passwrod}`,
    params: {
      dl: "登录",
    },
  });
};

export const residents = (num: number, num2: number) => {
  return axios({
    method: "get",
    url: `/userlist?_page=${num}&_limit=${num2}`,
    params: {
      zh: "住户列表",
    },
  });
};
export const residentss = () => {
  return axios({
    method: "get",
    url: `/userlist`,
    params: {
      zh: "住户列表长度",
    },
  });
};
export const modify = (id: string, data: object) => {
  return axios({
    method: "put",
    url: `/userlist/` + id,
    data: data,
    params: {
      zh: "修改住户信息",
    },
  });
};

export const deletes = (id: string) => {
  return axios({
    method: "delete",
    url: `/userlist/` + id,
    params: {
      zh: "删除住户信息",
    },
  });
};
export const visitors = () => {
  return axios({
    method: "get",
    url: `/chartDataTwo`,
    params: {
      zh: "访客",
    },
  });
};
export const chartDataOne = () => {
  return axios({
    method: "get",
    url: `/chartDataOne`,
    params: {
      zh: "人口",
    },
  });
};

export const chartDataThree = () => {
  return axios({
    method: "get",
    url: `/chartDataThree`,
    params: {
      zh: "管理",
    },
  });
};
// chartDataFour;
export const chartDataFour = () => {
  return axios({
    method: "get",
    url: `/chartDataFour`,
    params: {
      zh: "车辆用户",
    },
  });
};

export const management = () => {
  return axios({
    method: "get",
    url: `/zhanghao`,
    params: {
      dl: "管理者",
    },
  });
};

export const account = (id: string, data: object) => {
  return axios({
    method: "put",
    url: `/zhanghao/` + id,
    data: data,
    params: {
      zh: "修改管理信息",
    },
  });
};
export const deletesuname = (id: string) => {
  return axios({
    method: "delete",
    url: `/zhanghao/` + id,
    params: {
      zh: "删除管理信息",
    },
  });
};
